package chapter03.test;

public class Student2 {
    //成员变量
    private String name;
    private String number;
    private String className;
    private String desc;
    private static String school = "南工院";

    //构造方法
    // 无参构造方法
    public Student2() {
    }

    // 有参构造方法
    public Student2(String name, String number, String className, String desc) {
        this.name = name;
        this.number = number;
        this.className = className;
        this.desc = desc;
    }

    //成员方法
    public void printInfo() {
        System.out.println(String.format("Student into: 学号：%s，姓名：%s", this.number, this.name));
    }

    //封装 对属性的访问，使用getter、setter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static void main(String[] args) {
        Student2 student1 = new Student2();
        student1.setNumber("01");
        student1.setName("张三");
        student1.setClassName("2121");
        student1.setDesc("好好学习天天向上");
        student1.printInfo();
        System.out.println("学校：" + Student2.school);

        Student2 student2 = new Student2("李四", "02", "2121", "李四好好学习天天向上");

        student2.printInfo();
    }
}
